import React from 'react';
import ReactDOM from 'react-dom';
/* 
  高阶组件 是指的 一个函数 接受一个组件作为参数 然后返回一个新的组件
*/

class App extends React.Component {

  render() {
    console.log(this.props)
    return <div className=''>

    </div>;
  }
}

// function connect(Com) {

//   return class Temp extends React.Component {
//     render() {
//       return <Com className='box' qqq={123} www={666} {...this.props} />
//     }
//   }
// }
// App = connect(App)
function connect(cb1, cb2) {
  return function (Com) {
    let obj = {
      name: "珠峰"
    }
    return class Temp extends React.Component {
      state = {
        age: 102
      }
      render() {
        return <Com className='box' name={cb1(obj.name)} age={cb2(this.state.age)} qqq={123} www={666} {...this.props} />
      }
    }
  }
}
App = connect((name) => {
  return name + "哈哈哈"
}, (age) => {
  return age + 100
})(App)

ReactDOM.render(<App aa={123} />, document.getElementById('root'))